package org.thread.test06.ts.demo04;

/**
 * @author CSY
 * @date 2025 - 03 - 13
 */
public class MyThread extends Thread{
    /**
     * 锁对象
     */
    public static final String LOCK = "";

    @Override
    public void run() {
        synchronized (LOCK) {
            try {
                //线程等待 - wait方法释放锁对象 - 不唤醒不往下执行
                LOCK.wait();
                //线程唤醒后，执行的相关逻辑
                String name = Thread.currentThread().getName();
                System.out.printf("唤醒%s,执行相关代码%n",name);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
